<?php
namespace drivers;

class start{
    //运行
    static function run(){
        include_once '../func/functions.php';
        include_once '../vendor/autoload.php';
        self::autoload();
        self::session();
        self::define();
        self::route();
    }

    //自动加载
    static function autoload(){
        require_once 'autoload.php';
        spl_autoload_register('drivers\\autoload::inc');
    }

    //路由
    static function route(){
        $route = factory::routes();
        $route::dispatch();
    }

    //定义常量
    static function define(){
        factory::config()->getConfig('define');
    }

    //session设置
    static function session(){
        $sessionConf = factory::config()->getConfig('status');
        if ($sessionConf['session_open']){
            session_start();
        }
    }
}